home *** CD-ROM | disk | FTP | other *** search
/ PC World 2001 April / PCWorld_2001-04_cd.bin / Komunik / mozilla / MacOS / MacMozillaInstaller-0.8.sea-2.bin / Mozilla Installer / Installer Modules / browser.xpi / install.js
Text File  |  2001-02-15  |  4KB  |  84 lines

  1. // this function verifies disk space in kilobytes
  2. function verifyDiskSpace(dirPath, spaceRequired)
  3. {
  4.   var spaceAvailable;
  5.  
  6.   // Get the available disk space on the given path
  7.   spaceAvailable = fileGetDiskSpaceAvailable(dirPath);
  8.  
  9.   // Convert the available disk space into kilobytes
  10.   spaceAvailable = parseInt(spaceAvailable / 1024);
  11.  
  12.   // do the verification
  13.   if(spaceAvailable < spaceRequired)
  14.   {
  15.     logComment("Insufficient disk space: " + dirPath);
  16.     logComment("  required : " + spaceRequired + " K");
  17.     logComment("  available: " + spaceAvailable + " K");
  18.     return(false);
  19.   }
  20.  
  21.   return(true);
  22. }
  23.  
  24. var srDest = 18542;
  25.  
  26. var err = initInstall("Mozilla Seamonkey", "Browser", "5.0.0.2001021502"); 
  27. logComment("initInstall: " + err);
  28.  
  29. var fProgram = getFolder("Program");
  30. logComment("fProgram: " + fProgram);
  31.  
  32. if (verifyDiskSpace(fProgram, srDest))
  33. {
  34.     err = addDirectory("Program",
  35.                        "5.0.0.2001021502",
  36.                        "viewer",           // jar source folder
  37.                        fProgram,           // target folder 
  38.                        "",                 // target subdir 
  39.                        true );             // force flag 
  40.  
  41.     logComment("addDirectory() returned: " + err);
  42.  
  43.     var cf = getFolder("Chrome");
  44.     registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"toolkit.jar"),"content/global/");
  45.     registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"comm.jar"),"content/communicator/");
  46.     registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"comm.jar"),"content/editor/");
  47.     registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"comm.jar"),"content/navigator/");
  48.     registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"comm.jar"),"content/necko/");
  49.     registerChrome(SKIN | DELAYED_CHROME, getFolder(cf,"classic.jar"),"skin/classic/communicator/");
  50.     registerChrome(SKIN | DELAYED_CHROME, getFolder(cf,"classic.jar"),"skin/classic/editor/");
  51.     registerChrome(SKIN | DELAYED_CHROME, getFolder(cf,"classic.jar"),"skin/classic/global/");
  52.     registerChrome(SKIN | DELAYED_CHROME, getFolder(cf,"classic.jar"),"skin/classic/messenger/");
  53.     registerChrome(SKIN | DELAYED_CHROME, getFolder(cf,"classic.jar"),"skin/classic/navigator/");
  54. //    registerChrome(SKIN | DELAYED_CHROME, getFolder(cf,"blue.jar"),"skin/blue/communicator/");
  55. //    registerChrome(SKIN | DELAYED_CHROME, getFolder(cf,"blue.jar"),"skin/blue/editor/");
  56. //    registerChrome(SKIN | DELAYED_CHROME, getFolder(cf,"blue.jar"),"skin/blue/global/");
  57. //    registerChrome(SKIN | DELAYED_CHROME, getFolder(cf,"blue.jar"),"skin/blue/messenger/");
  58. //    registerChrome(SKIN | DELAYED_CHROME, getFolder(cf,"blue.jar"),"skin/blue/navigator/");
  59.     registerChrome(SKIN | DELAYED_CHROME, getFolder(cf,"modern.jar"),"skin/modern/communicator/");
  60.     registerChrome(SKIN | DELAYED_CHROME, getFolder(cf,"modern.jar"),"skin/modern/editor/");
  61.     registerChrome(SKIN | DELAYED_CHROME, getFolder(cf,"modern.jar"),"skin/modern/global/");
  62.     registerChrome(SKIN | DELAYED_CHROME, getFolder(cf,"modern.jar"),"skin/modern/messenger/");
  63.     registerChrome(SKIN | DELAYED_CHROME, getFolder(cf,"modern.jar"),"skin/modern/navigator/");
  64.  
  65.     // make an alias to the browser on the desktop 
  66.     var desktopFolder = getFolder("Mac Desktop");
  67.     var ignoreErr = fileMacAlias(fProgram,      "Mozilla",   // source
  68.                              desktopFolder, "Mozilla");  // target
  69.     logComment("fileMacAlias() returned: " + ignoreErr);
  70.  
  71.     if (err==SUCCESS)
  72.     {
  73.         err = performInstall(); 
  74.         logComment("performInstall() returned: " + err);
  75.     }
  76.     else
  77.     {
  78.         cancelInstall(err);
  79.         logComment("cancelInstall() due to error: " + err);
  80.     }
  81. }
  82. else
  83.     cancelInstall(INSUFFICIENT_DISK_SPACE);
  84.